﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Web;

namespace WebAPI
{
    /// <summary>
    /// Upload 的摘要说明
    /// </summary>
    public class Upload : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            var files = context.Request.Files;

            //获取上传的文件名
            string fileName = files[0].FileName;

            //获取上传的文件后缀名
           //string filefi = Path.GetExtension(fileName).ToLower();
           // if (filefi == ".png" || filefi == ".jpg" || filefi == ".jpeg" || filefi == ".pic")
           // { 
          //}
                //判断后缀名属于哪些文件

                //C:\\Users\\Overlord\\Desktop\\UserAvatar\\
                files[0].SaveAs(context.Server.MapPath(".\\Flie\\" + fileName));
                context.Response.Write("");
            

            
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}